﻿using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;

public class SavePrefabe : MonoBehaviour
{


    /// <summary>
    /// 保存预制体
    /// </summary>
    /// <param name="obj"></param>
    /// <param name="prefabName"></param>
    public static void CreatePrefabObj(GameObject obj, string SavePath = "Assets/Resources/UI")
    {
        string path = SavePath + "/" + obj.name + ".prefab";
        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);  //创建文件夹
        }
        PrefabUtility.CreatePrefab(path, obj);
    }
}
